package chapter05

object Test05_Lambda {
  def main(args: Array[String]): Unit = {
    val fun: String => Unit = (name: String) => {
      println("name: " + name)
    }
    fun("bob")
    println("===================================================")

    def f(func: String => Unit): Unit = func("123456")

    f(fun)
    f((name: String) => println("name: " + name))
    println("===================================================")
    f(name => println("name: =" + name))
    //如果对参数的操作就是一个方法，则直接写方法名即可
    f(println)

    def a(func: String => Unit): Unit = func("name")

    a(println)
  }
}
